<extend name="Public/base" />

<block name="body">
<div class="row">
	<div class="col-lg-12">
		<div class="main-box clearfix">
			<header class="main-box-header clearfix">
				<h2 class="pull-left">英雄列表</h2>
				<div class="filter-block pull-right">
					<div class="form-group pull-left search-form">
						<input type="text" name="hero_name"
							class="form-control search-input" placeholder="英雄名称..."
							value="{:I('hero_name')}"> <i
							class="fa fa-search search-icon" id="search" url="{:U('index')}"></i>
					</div>
					<a href="{:U('/LOL/LolHero/add')}"
						class="btn btn-primary pull-right"> <i
						class="fa fa-plus-circle fa-lg"></i> 添加英雄
					</a>
				</div>
			</header>
			<div class="main-box-body clearfix">
				<div class="table-responsive">
					<table class="table">
						<thead>
							<tr>
								<th class="text-left"><span>ID</span></th>
								<th class="text-left"><span>大名</span></th>
								<th class="text-left"><span>小名</span></th>
								<th class="text-center">操作</th>
							</tr>
						</thead>
						<tbody>
							<notempty name="_list"> <volist name="_list" id="vo">
							<tr>
								<td>{$vo.id}</td>
								<td>{$vo.name}</td>
								<td>{$vo.nick}</td>
								 
								<td style="width: 15%;"> <a
									href="{:U('LOL/LolHero/changeStatus?method=delete&id='.$vo['id'])}"
									class="table-link danger confirm ajax-get"> <span
										class="fa-stack"> <i class="fa fa-square fa-stack-2x"></i>
											<i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
									</span>
								</a></td>
							</tr>
							</volist> <else />

							<td colspan="6" class="text-center">aOh! 暂时还没有内容!</td>
							</notempty>
						</tbody>
					</table>
				</div>

				<div>{$_page}</div>

			</div>
		</div>
	</div>
</div>
</block>

<block name="script"> <script type="text/javascript">
	//搜索功能
	$("#search").click(function() {
		var url = $(this).attr('url');
		var query = $('.search-form').find('input').serialize();
		query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
		query = query.replace(/^&/g, '');
		if (url.indexOf('?') > 0) {
			url += '&' + query;
		} else {
			url += '?' + query;
		}
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e) {
		if (e.keyCode === 13) {
			$("#search").click();
			return false;
		}
	});
</script> </block>